local ServerOHOH = _G.ServerOHOH;
local M = ServerOHOH.class.new(script, ServerOHOH.files.Server_PlayerComponent());


function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
    local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = self.parent.main_inst

    self.leaderstatsFolder=leaderstats

   self.Kill = Instance.new("IntValue",self.leaderstatsFolder)
   self.Kill.Name = "Kill"

   self.Rebirth = Instance.new("IntValue",self.leaderstatsFolder)
   self.Rebirth.Name = "Rebirth"

   self.Level = Instance.new("IntValue",self.leaderstatsFolder)
   self.Level.Name = "Level"

    self.DataBase=self.parent:GetComponent(ServerOHOH.load.Server_PlayerDataComponent())

    self.Rebirth.Value=self.DataBase:GetData("base").rebirth
    self.Kill.Value=self.DataBase:GetData("statistics").kill
    self.Level.Value=self.DataBase:GetData("base").level



    self.parent.UserDataEvent:Connect(function(key)
        if key=="base" then
            self.Rebirth.Value=self.DataBase:GetData("base").rebirth
            self.Level.Value=self.DataBase:GetData("base").level
        elseif key=="statistics" then
            self.Kill.Value=self.DataBase:GetData("statistics").kill
        end
    end)
end;




function M.dtor(self)
	M.super.dtor(self);
end;

return M